#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

bool cmp(long long a, long long b)
{
    return a>b;
}

int main()
{
    ios::sync_with_stdio(false);
    long long C, M, N, tmp;
    vector<long long> numbers;
    cin >> C;
    while(C--)
    {
        numbers.clear();
        cin >> N >> M;
        for(int i=0; i<N; i++)
        {
            cin >> tmp;
            numbers.push_back(tmp);
        }
        sort(numbers.begin(), numbers.end(), cmp);
        for(int i=0; i<M; i++)
        {
            cout << numbers[i] << " ";
        }
        cout << endl;
    }
    return 0;
}